const MakeDownloadForm = {
  downloadForm: Node,

  constructor (apiPath, userToken, downPath) {
    const downloadForm = document.createElement('form')
    const tokenInput = document.createElement('input')
    const pathInput = document.createElement('input')
    // 构建表单
    downloadForm.method = 'POST'
    downloadForm.style.display = 'none'
    downloadForm.action = apiPath
    // 填入字段内容
    tokenInput.name = 'token'
    tokenInput.value = userToken
    pathInput.name = 'path'
    pathInput.value = downPath
    downloadForm.appendChild(tokenInput)
    downloadForm.appendChild(pathInput)
    // 挂载
    this.downloadForm = downloadForm
  },
  get () {
    // document.body.appendChild(this.downloadForm)
    // this.downloadForm.submit()
    // document.body.removeChild(this.downloadForm)
    return this.downloadForm
  }
}

// tokenInput.value = this.$store.state.token
module.exports = MakeDownloadForm
